package edu.hcmus.sow.domain.security;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.security.core.userdetails.User;

public class CustomUser extends User {

   private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;

   // ~ Instance fields
   // ================================================================================================
   private final Integer userID;
   private final Integer clientID;

   // ~ Constructors
   // ===================================================================================================

   /**
    * Calls the more complex constructor with all boolean arguments set to {@code true}.
    */
   public CustomUser(Integer userID, Integer clientID, String username, String password,
         Collection<? extends GrantedAuthority> authorities) {
      this(userID, clientID, username, password, true, true, true, true, authorities);
   }

   public CustomUser(Integer userID, Integer clientID, String username, String password, boolean enabled,
         boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
         Collection<? extends GrantedAuthority> authorities) {
      super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);

      this.userID = userID;
      this.clientID = clientID;
   }

   public Integer getUserID() {
      return userID;
   }

   public Integer getClientID() {
      return clientID;
   }
}
